<%@page import="edu.hcmus.sow.utils.SowUtil"%>
<%@page import="org.ocpsoft.pretty.time.PrettyTime"%>
<%@page import="java.util.Date"%>
<%@ page language="java" isELIgnored="false" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<jsp:directive.include file="/WEB-INF/sitemesh-decorators/include.jsp" />
<fmt:setBundle basename="bundles.dashboard-resources" />
<c:set var="menu" value="dashboard" scope="request" />

<html>
<body>
   <link href="${pageContext.request.contextPath}/css/FeedPanel.css" rel="stylesheet" type="text/css" />
   <link href="${pageContext.request.contextPath}/css/companyWorkspaceDash.css" rel="stylesheet" type="text/css" />
   <div class="cubeTitleWrapper">
      <span class="cube_title">Dashboard</span>
   </div>

   <div>
      <div class="rightcolumnw">
         <div class="innertube" style="margin-left: 14px;">
            <div></div>
            <div class="companyActivity">
               <h2 class="userDefinedBg filter">
                  <span class="start">Latest Activity</span>
                  <a class="rss tooltip" href="#" title="Click to subscribe to the RSS feed of all the activites across all your wokspaces">RSS</a>
                  <span style="display: none" class="filter">
                     <label style="padding-left: 15px;">View:&nbsp;&nbsp;</label> 
                     <select class="" style="width: 120px; margin-right: 5px" name="orderby">
                        <option value="0">By Workspace</option>
                        <option selected="selected" value="1">Time</option>
                     </select>
                  </span>
               </h2>
               <div class="contentBlock newFeed">
                  <div>
                     <a style="display: none" href="#" id="showItemsLink" onclick="">
                     </a>
                  </div>
                  <div id="latestFeeds">
                     <div>
                        <div>
                           <ul class="list list_simple activitylist" id="container12">
                           <!-- user activities list -->
                           <c:forEach items="${userActivities}" var="userActivity" varStatus="i">
                              <li id="id${userActivity.id}">
                                 <div class="fixed activity_infos">
                                    <div class="comments">
                                       <a class="comments" href="#"><span>0</span></a>
                                    </div>
                                    <table class="dateDetail">
                                       <tbody>
                                          <tr>
                                             <td>
                                                <div class="date">
                                                <c:set var="loggedDate" value="${userActivity.loggedDate.getTime()}" />
                                                   <span class="date_text">
                                                      <span><%=new PrettyTime().format((Date) pageContext.getAttribute("loggedDate"))%></span> by
                                                      <span>${userActivity.user.username}</span>
                                                   </span>
                                                </div>
                                             </td>
                                          </tr>
                                       </tbody>
                                    </table>
                                    <span>
                                    <a class="profileThumb" href="#">
                                       <span class="thumbmask">
                                          <span class="topleft"></span>
                                          <span class="topright"></span>
                                          <span class="bottomleft"></span>
                                          <span class="bottomright"></span>
                                          <img id="profileImg14" src='<c:url value="/images/default_profile.png" />'>
                                       </span>
                                    </a>
                                    </span>
                                 </div>
                                 <div class="fluid">
                                 <c:set var="targetType" value="${userActivity.targetType}" />
                                    <img class="icon" id="feedTypeImg${userActivity.id}" src='<c:url value='<%=SowUtil.getTypeImg((String)pageContext.getAttribute("targetType")) %>' />'>
                                    <div class="activitytitle">
                                       ${map[i.index]}
                                       <p style="display: none">
                                          <span>${userActivity.id}</span>&nbsp;<a href="#">more</a>
                                       </p>
                                    </div>
                                 </div>
                              </li>
                           </c:forEach>
                           <!-- end user activities list -->
                           </ul>
                           <div class="viewMore"></div>
                           <div id="empty73" style="display: none"></div>
                        </div>
                     </div>
                  </div>
               </div>
               <div class="contentBlock_bottom">
                  <span class="right_end"><span></span></span>
               </div>
            </div>
         </div>
      </div>
      
      <div class="contentwrapperw">
         <div class="contentcolumnw">
            <div class="innertube">
               <h2 class="userDefinedBg filter" id="workspaceFilterContainer74">
                  <span>Repositories</span>
               </h2>
               <div class="contentBox_body">
                  <div class="contentBlock" id="allProjectsContainer76">
                     <div id="allProjects" class="wicket-tree">
                        <ul class="list list_simple activitylist" id="container12">
                        <c:forEach items="${repositories}" var="repository">
                           <li>
                              <div style="padding-bottom: 5px; line-height: 20px">
                              <img style="vertical-align: middle;" class="icon" src='<c:url value="/images/folderIcon.png" />'>
                              <a style="text-decoration: none;" class="dashboard-sow" href="<c:url value='/repository/${repository.id}' />"><span>${repository.name}</span></a>
                              </div>
                           </li>
                        </c:forEach>
                        </ul>
                        <span></span>
                     </div>
                     <div class="spacer"></div>
                  </div>
                  <div class="contentBlock_bottom">
                     <span class="right_end"><span></span></span>
                  </div>
               </div>
            </div>
         </div>
      </div>
      <div id="msg"></div>
      <div id="newAdminMsg"></div>
   </div>
</body>
</html>